package com.itheima.dao.impl;

import com.itheima.dao.IEmployeeDao;
import org.springframework.jdbc.core.JdbcTemplate;


public class EmployeeImpl implements IEmployeeDao {

    JdbcTemplate jdbcTemplate;

    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }


    public void reduceAccounts(String userName, Double money) {
        jdbcTemplate.update("update employee set salary = salary-? where emp_name = ?",money,userName);
    }

    public void addAccounts(String userName, Double money) {
        jdbcTemplate.update("update employee set salary = salary+? where emp_name = ?",money,userName);

    }
}
